#!/bin/bash
yum groupinstall "X Window System" -y
yum groupinstall xfce-4.4 -y
yum install vnc-server firefox -y
yum -y groupinstall chinese-support
yum -y install flash-plugin
test > /etc/sysconfig/vncservers
{
cat << djidc
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800x600"
djidc
} > /etc/sysconfig/vncservers
vncpasswd 
echo -e "127.0.0.1\t$HOSTNAME" >> /etc/hosts
sed '1!G;h;$!d' -i /etc/sysconfig/iptables
sed '2a-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5901 -j ACCEPT' -i /etc/sysconfig/iptables
sed '1!G;h;$!d' -i /etc/sysconfig/iptables
chkconfig vncserver on
service vncserver restart
sed -i '1a\/usr/bin/startxfce4' .vnc/xstartup

